package cn.edu.glut.dto;

import javax.validation.constraints.NotNull;

import org.springframework.beans.BeanUtils;

import cn.edu.glut.entity.Teacher;
import cn.edu.glut.utils.ValidValue;
import lombok.Data;

@Data
public class TeacherInputDTO implements DTOConvert<Teacher>{
	private String id;
	@NotNull(message = ValidValue.Valid_MSG.USERNAME_NOT_NULL)
	private String username;
	@NotNull(message = ValidValue.Valid_MSG.PASSWORD_NOT_NULL)
	private String password;
	@NotNull(message = ValidValue.Valid_MSG.NAME_NOT_NULL)
	private String nickname;
	@NotNull(message = ValidValue.Valid_MSG.CONTACT_NOT_NULL)
	private String contact;
	private String description;
	
	@Override
	public Teacher convertToEntity() {
		Teacher t = new Teacher();
		BeanUtils.copyProperties(this, t);
		return t;
	} 
}
